import type { Unit } from './common'
// 采购计划单
// 获取采购计划单主表参数接口
export interface PurchasePlanBillPageParams {
	page: number
	rows: number
	r: {
		businessDate: string[]
	}
	orl: {
		sysBillCode: string,
		userBillCode: string
	},
	i: {
		billState?: (number|string)[]
		billType: (number|string)[]
		organId: (number|string)[]
		otherOrganId: (number|string)[]
	},
	o: {
		businessDate: string,
		sysBillCode: string
	}
}
// 业务日期区间接口
export interface BusinessDate {
	begin: string
	end: string
}
// 采购计划单筛选条件接口
export interface FilterData {
	businessDate: string[]
}

export interface TagSelectItem {
	id: string|number
	label: string
}
// 联系地址接口
export interface ContactItem {
	linkMan: string
	tel: string
	location: string
}
// 选项接口
export interface OrganItem {
	id: string
	name: string
	code?: string
	organType?: string
	contactList?: ContactItem[]
}
// 加急接口
export interface UrgentItem {
	id: number
	name: string
}
// 附件队列接口
export interface AppendicesItem {
	appendixUrl: string
}
// 品项类别接口
export interface ItemType {
	id: string
	name: string
	children?: ItemType[]
}
// 品项单位接口
export interface ItemUnit extends Unit {
	mainFlag: boolean
}
// 品项明细接口
export interface ItemDetail {
	id: string
	item: {
		id: string
		name: string
		code: string
		spec: string
		itemType: string
		canWeigh: number
		assistUnit: string
		itemUnitList: ItemUnit[]
		imageUrl: string
	}
	amount: number
	itemUnit: ItemUnit
	itemUnitList: ItemUnit[]
	inHouse: OrganItem
	checked?: boolean
	stock?: number
	sellerOrganName?: string
	sellerAmount?: number
	assistUnit?: string
	assistUnitAmount?: number
	expectArrivalDate: string
	memo: string
	rootItemType?: ItemType
	stockPlanDetail: {
		arrivalCycle: string
		unitId: string
		supperLimit: number
		lowerLimit: number
		roundingWay: number
		roundingNum: number
	}
	$fxCalculation: string
	terminal?: number
	abortAssign?: number
	assignAmount?: number
	assignState?: number
	giveUpAmount?: number
	isAdded?: boolean
	sellerPrice?: string | number
	sellerMoney?: string | number
	inquiryFlag?: number
}
// 单据业务类型接口
export interface BillBizTypeItem {
	id: string
	name: string
}
// 未添加品项信息接口
export interface ItemInfo {
	id: string
	name: string
	code: string
	spac: string
	itemType: string
	canWeigh: number
	assistUnit: string
	itemUnitList: ItemUnit[]
	rootItemType: ItemType
	stockPlanDetail: {
		arrivalCycle: string
		unitId: string
		supperLimit: number
		lowerLimit: number
		roundingWay: number
		roundingNum: number
	}
}
// 单据信息接口
export interface BillDetail {
	id: string
	billSign?: number
	billType: number
	subBillType: number
	billTypeName: string
	billState: number
	assignStatus: number
	recheckState?: number
	sysBillCode: string
	businessDate: string
	expectDate?: string
	singleHouseFlag: number
	urgent: number
	billBizType: {
		id: string
		name: string
	}
	stockPlan: {
		id: string
		name: string
	}
	organ: {
		id: string
		name?: string
		organType?: string
	}
	inHouse: {
		id: string
		name?: string
	}
	operateMan: {
		id: string
		name?: string
	}
	version: number
	details: ItemDetail[]
	appendixList: AppendicesItem[]
	userBillCode?: string
	memo? :string
	linkman: string
	phone: string
	deliveryAddr: string
	carriageFee: number
	detailAmount: number
	noStockPlanItems?: ItemInfo[]
	noStockPlanItemDetails?: ItemDetail[]
	stockPlanTypes?: ItemType[]
	noStockPlanTypes?: ItemType[]
	weightItemTypeTree?: ItemType[]
	noWeightItemTypeTree?: ItemType[]
}
// 品项库存信息接口
export type ItemStockData = {
	amount?: number
	sellerOrgan?: string
	sellerAmount?: number
	sellerPrice?: number
	sellerMoney?: number
}
// 异常警告称重组件实例接口
export interface ScalesContainerRef {
	openScales: (detailsList:ItemDetail[], item?:ItemDetail) => void
}
// 异常警告组件实例接口
export interface MistakeCheckRef {
	mistakeCheck: (type:string) => void
}
// 异常警告数据接口
export interface MistakeCheckResponse {
	checkResult: boolean
	errorDetailList: []
	minStep: string
}
// 品项订货分类
export interface ItemProductCategories {
	id: string,
	name: string
}

